const express = require('express');
const path = require('path');

const app = express();
const port = process.env.PORT || 5173;

// 指定静态文件目录
app.use(express.static(path.join(__dirname, 'dist')));

// 配置 SPA 路由
app.get('*', (req, res) => {
  res.sendFile(path.resolve(__dirname, 'dist', 'index.html'));
});

app.listen(port, () => {
  console.log(`Server is running at http://localhost:${port}`);
});
